/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.vsu.csf.qasystem.syntax;

import java.util.ArrayList;
import java.util.List;
import ru.vsu.csf.qasystem.morph.Word;

/**
 * Элемент синтаксического дерева.
 * @author Руслан
 */
public class SyntaxElement {
    
    private Word value;
    
    private List<SyntaxElement> children;
    
    private Integer index;
    
    public SyntaxElement() {
        children = new ArrayList<SyntaxElement>();
        
    }
    
    public SyntaxElement(Word value) {
        this.value = value;
        children = new ArrayList<SyntaxElement>();
        
    }
    
    @Override
    public SyntaxElement clone() {
        SyntaxElement element = new SyntaxElement(value);
        for(SyntaxElement child : children) {
            element.addChild(child);
        }
        return element;
    }

    public Word getValue() {
        return value;
    }

    public void setValue(Word value) {
        this.value = value;
    }

    public List<SyntaxElement> getChildren() {
        return children;
    }
    public void setChildren(List<SyntaxElement> children) {
        this.children = children;
    }
    
    public void addChild(SyntaxElement element) {
        children.add(element);
    }

    public Integer getIndex() {
        return index;
    }

    public void setIndex(Integer index) {
        this.index = index;
    }
    
    
}
